package org.je.log;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

public class ErrorUtil
{
	/**
	 * @param ex
	 * @return stack bytes
	 */
	public static byte[] toBytes(Throwable ex) {
		if (ex == null) {
			return new byte[0];
		}
		ByteArrayOutputStream out = new ByteArrayOutputStream();
		ex.printStackTrace(new PrintStream(out));
		return out.toByteArray();
	}
}
